home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 1010 < prev    next >
Encoding:
Text File  |  1996-08-05  |  678 b   |  28 lines

  1. Newsgroups: comp.lang.c
  2. Path: twisto.eng.hou.compaq.com!news
  3. From: garyc%cs%contractors@bangate.compaq.com (Gary Clarke)
  4. Subject: Bit Masking
  5. Message-ID: <DKz5y4.8En@twisto.eng.hou.compaq.com>
  6. Sender: news@twisto.eng.hou.compaq.com (System Administrator)
  7. Organization: Compaq Computer Corp.
  8. Date: Wed, 10 Jan 1996 17:06:24 GMT
  9. X-Newsreader: Forte Free Agent 1.0.82
  10. X-Nntp-Posting-Host: moe.cs.hou.compaq.com
  11.  
  12. Can someone tell me the elegent way to clear specific bits from a
  13. byte, e.g.
  14.  
  15. # define BIT_1    1
  16. # define BIT_2    2
  17. # define BIT_3    4
  18. # define BIT_4    8
  19.  
  20. Set the bit:    x |= BIT_x
  21.  
  22. Clear the bit using BIT_x:    ????
  23.  
  24. Thankyou, Gary Clarke
  25.  
  26. GaryC%cs%contractors@bangate.compaq.com
  27.  
  28.